cp python

26

import shutil

original = r'original path where the file is currently stored\file name.file extension'
target = r'target path where the file will be copied\file name.file extension'

shutil.copyfile(original, target)
import shutil

source = r"C:\Users\tsmehra\dev\example\demo.txt"
destination = r"D:\example2"

print("The demo.txt has copied at:")
print(shutil.copy(source, destination))

Output

The demo.txt has copied at:
D:\example2\demo.txt

Comments

Submit
0 Comments